home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
64'er 1988 February
/
64er_Magazin_88-02_1988_Markt__Technik_de_Side_A.d64
/
x^3-julia-mengen
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-10-26
|
2KB
|
74 lines
10 rem ****************************
20 rem * julia-mengen (x^3) *
30 rem * 1987 by stefan vilsmeier *
40 rem ****************************
50 :
60 if a=0 then a=1:load "fractal.obj",8,1
70 open 1,8,15,"u9":close 1: rem diese zeile kann bei problemen mit dem
80 rem floppyspeeder weggelassen werden!
90 poke53280,0:poke53281,0
100 :
110 :
120 rem ******* eingaben ***********
130 :
140 input"[147]anfang realteil ";x1
150 input"ende realteil ";x2
160 input"anfang imaginaerteil ";y1
170 input"ende imaginaerteil ";y2
180 input"anzahl der iterationen ";z
190 :
200 :
210 rem ******* konstanten *********
220 :
230 ep=.0025:w=2/3
240 xa=1:ya=0:xb=-.5:yb=.8660254:xc=-.5:yc=-.8660254
250 sys 50176,14,0:sys 50179,1:sys 50194:rem grafik ein
260 :
270 :
280 rem ****************************
290 rem * hauptschleife *
300 rem ****************************
310 :
320 dx=(x2-x1)/320:dy=(y1-y2)/200
330 for yy=0 to 199
340 :for xx=0 to 319
350 : f=0:zz=0:za=0
360 : x = x1 + xx*dx:y = y2 + yy*dy
370 : xq = x*x:yq = y*y
380 : n = xq + yq:if n=0 then n=1e-5
390 : gosub 530:rem ******** check
400 : if zz<z and f=0 goto 390
410 : if f=4 then sys 50182,xx,yy,1
420 :next xx
430 next yy
440 get a$:if a$="" goto 440
450 sys 50179,0:if a$="s" then gosub 700: rem 'grafik speichern'
460 goto 110: rem neustart
470 :
480 :
490 rem ****************************
500 rem * 'check' *
510 rem ****************************
520 :
530 za = -2*((x-xa)*(x-xa)+(y-ya)*(y-ya)<=ep)
540 za = za-3*((x-xb)*(x-xb)+(y-yb)*(y-yb)<=ep)
550 za = za-4*((x-xc)*(x-xc)+(y-yc)*(y-yc)<=ep)
560 :
570 zz = zz+1
580 n = n*n*3:xy = x*y
590 x = w*x+(xq-yq)/n:y = w*y-(xy+xy)/n
600 xq = x*x:yq = y*y
610 n = xq + yq
620 f = -(n<1e-18)
630 if f=0 then f=-(n>1e+18)
640 if f=0 then f=za
650 return
660 :
670 rem ***************************
680 rem * 'grafik speichern' *
690 rem ***************************
700 :
710 input "grafik-name ";n$
720 open 2,8,2,"pi."+n$+",p,w":sys 50191:close 2
730 return